<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:60:"D:\www\fdc\public/../application/manage\view\admin\edit.html";i:1474514364;}*/ ?>
<!--编辑管理员-->
<div class="dialog_content">
	<form id="info_form" action="<?php echo url('Admin/editDo'); ?>" method="post">
	<table width="100%" class="table_form">
		<tr>
      		<th width="80">管理员名称 :</th>
      		<td><input type="text" name="username" id="J_username" class="input-text" value="<?php echo $info['username']; ?>"></td>
    	</tr>
        <tr>
            <th width="80">所属角色 :</th>
            <td>
                <select name="role_id">
                    <?php if(is_array($role) || $role instanceof \think\Collection || $role instanceof \think\Paginator): $i = 0; $__LIST__ = $role;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                        <option value="<?php echo $vo['id']; ?>" <?php if($vo['id'] == $info['role_id']): ?>selected='selected'<?php endif; ?>><?php echo $vo['title']; ?></option>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </td>
        </tr>
    	<tr> 
      		<th>密码 :</th>
      		<td><input type="password" name="password" id="J_password" class="input-text"></td>
    	</tr>
    	<tr>
      		<th>确认密码 :</th>
      		<td><input type="password" name="repassword" id="J_repassword" class="input-text"></td>
    	</tr>
      <tr>
        <th>管理员邮箱 :</th>
        <td><input type="text" name="email" class="input-text" value="<?php echo $info['email']; ?>" size="30"></td>
      </tr>

	</table>
	<input type="hidden" name="id" value="<?php echo $info['id']; ?>" />
	</form>
</div>

<script>
var check_name_url = "<?php echo url('Admin/ajaxCheckName', ['id'=>$info['id']]); ?>";
$(function(){
	$.formValidator.initConfig({formid:"info_form",autotip:true});

	$("#J_username").formValidator({ onshow:'请填写用户名', onfocus:'请填写用户名'}).inputValidator({ min:1, onerror:'请填写用户名'}).ajaxValidator({type:"get", url:check_name_url, datatype:"html", async:'false', success:function(data){	if( data == "1" ){return true;}else{return false;}}, onerror:'用户名已存在', onwait:'验证中，请稍候...'}).defaultPassed();
	$("#J_password").formValidator({ empty:true, onshow:'请填写密码', onfocus:'密码长度为6-20之间'}).inputValidator({ min:6, max:20, onerror:'密码应为6-20个字符之间'});
	$("#J_repassword").formValidator({ empty:true, onshow:'请填写确认密码', onfocus:'填写确认密码'}).compareValidator({desid:"J_password",operateor:"=",onerror:'两次密码输入不一致'});

	$('#info_form').ajaxForm({success:complate,dataType:'json'});
    function complate(result){
        if(result.status == 1){
            $.dialog.get(result.dialog).close();
            $.yingloujie.tip({content:result.msg});
            setTimeout(function(){window.location.reload();},1000);
        } else {
            $.yingloujie.tip({content:result.msg, icon:'alert'});
        }
    }
});
</script>